1. Field of the Invention
The present invention relates to a shape detection apparatus used in the assembly process of a factory manufacturing line for visual recognition processing image data obtained from a target object by an imaging means, and recognizing such primary features of the target object such as shape, position, and attitude for use in such processes such as pass/fail quality determination and positioning for equipment operation.
2. Description of the Prior Art
Various shape detection principles have been applied according to the application and shape of the target object in conventional shape detection apparatuses. A conventional shape detection apparatus using the shape detection principle is described below with reference to FIG. 16.
In FIG. 16, one example of conventional shape detection apparatuses is shown. This shape detection apparatus detects the center of circular subjects wherein there is no contrast in image brightness other than at the contour lines. This may occur when a target object Ob of which the shape is being detected is a screw hole in sheet metal, for example. The shape detection apparatus in this example may be used to position machinery for screwing a screw into said screw hole.
A television camera or similar visual image sensor 1 captures an image of the object of which the shape is to be detected, and outputs the resulting image data Sv. The image memory 2 stores the digitized image data output by the visual sensor 1. The contour line shape detector 3 scans the image data Sm stored in the image memory 2 by means of a circular window 5 matching the shape of the target image, and detects the position at which the circular window matches the target image.
Herebelow, the principle of detecting the position of a circular target object and the center thereof at high speed by means of a window shaped similarly to the contour lines of that object is described with reference to FIGS. 14 and 15. Note that the circular window 5 shown in FIG. 14 is contour line-shaped window of which the shape conforms to he contour lines of a reference image of the circular target object. Line windows 4a to 4h used for density difference detection are placed in the circular window 5 intersecting the outside edge of the circular window 5. The density difference detection line windows 4a to 4h are thus able to detect both outside image data 6 and inside image data 7 outside and inside, respectively, the circular window 5 in the area near the circumference.
The contour line shape detector 3 scans the image stored in the image memory 2 using this circular window 5. During this scanning operation, the density difference detection line windows 4a to 4h detect the outside image data 6 and the inside image data 7 outside and inside, respectively, the circular window 5. The image density difference between the outside image data 6 and inside image data 7 detected by the density difference detection line windows 4a to 4h is determined at each scanning position, and compared with an image data threshold value. The position of the circular window 5 where the number of density difference detection line windows at which the detected image density difference exceeds the threshold value is greatest is determined to be the image position of the circular target object. This detection method can be achieved by means of a relatively simple measurement and comparison operation, and enables high speed image detection.
With this method described above, the circular window 5 can quickly detect whether a circular image is at the scanning position or not, and can therefore scan quickly using a large scanning pitch to a point near the image to be detected. To detect the true image position, however, the scanning pitch must be reduced at a point near the target image, and the circular window 5 must be accurately aligned with the circular image. This limits the maximum achievable scanning and processing speed.
In addition, because the position detection precision obtained with the density difference detection line windows 4a to 4h is one-half the length of the window 4a to 4h, if the length of the windows 4a to 4h is shorter than the length allowable for the required detection precision, the diameter of the circular target image and the diameter of the circular window 5 will not match. For example, if the diameter of the circular window 5 is smaller than the diameter of the image of the circular target as shown in FIG. 15, the position of the circular window 5 where the number of density difference detection line windows at which the detected image density difference exceeds the threshold value is greatest will not be concentric to the image of the circular target; the circular window 5 will be positioned touching the inside of the contour line of the circular target image, and an error of one-half the difference between the diameter of the circular window 5 and the diameter of the image of the circular target may result.